<template>
  <div class="step">
    <div
      class="step-item"
      v-for="(item, index) in infos"
      :class="{
        'step-item--active': active == index,
        'step-item--success': item.status === 2,
        'step-item--loading': item.status === 1,
      }"
      @click="handleStepClick(index)"
    >
      <div class="step-item-warp">
        <div class="step-item-number">
          <template v-if="item.status === 1">
            <el-icon class="is-loading"><Loading /></el-icon>
          </template>
          <template v-else>
            {{ index + 1 }}
          </template>
        </div>
        <div class="step-item-label">{{ item.label }}</div>
        <div class="step-item-status">
          {{ { 0: '等待中', 1: '分析中', 2: '已完成' }[item.status] }}
        </div>
      </div>
    </div>
  </div>
</template>
<script setup></script>
<style lang="scss" scoped>
.step {
  display: flex;
  position: relative;
  justify-content: space-between;
  margin: 0 20%;
  overflow: hidden;
}

.step-item {
  position: relative;
  &::before {
    width: 9999px;
    background-color: #e5e6eb;
    height: 2px;
    z-index: 1;
    position: absolute;
    left: 0;
    top: 16px;
    content: '';
    z-index: 1;
  }
  &:last-child::before {
    display: none;
  }
}

.step-item-warp {
  display: flex;
  align-items: center;
  flex-direction: column;
  flex: 1;
  cursor: pointer;
  background-color: #fff;
  z-index: 2;
  position: relative;
}

.step-item-icon {
  width: 48px;
  height: 48px;
  background-color: #f3f4f6;
  border-radius: 100%;
  margin-bottom: 6px;

  display: flex;
  align-items: center;
  justify-content: center;
  i {
    font-size: 25px;
  }
}

.step-item--active {
  // color: #2563eb;
}

.step-item-number {
  width: 36px;
  height: 36px;

  background-color: #f5f7fa;
  color: rgba($color: #000000, $alpha: 0.3);

  border-radius: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
  font-size: 18px;
}

.step-item--loading {
  .step-item-number {
    background-color: #3366ff;
    color: #fff;
  }
}

.step-item--success {
  .step-item-number {
    background-color: #22c55e;
    color: #fff;
    font-weight: bold;
  }
}

.step-item-label {
  font-size: 16px;
  font-weight: bold;
  color: #000;
}

.step-item-status {
  font-size: 12px;
  margin-top: 6px;
  margin-bottom: 6px;
  color: #999;
}
</style>
